import { Navigate } from "react-router-dom";
import { useSelector } from "react-redux";

function Auth({ children }) {
    const token = useSelector((state) => state.user.token)
    if (token) {
        return (
            children
        )
    }
    else {
        return (
            <Navigate to="/login" />
        )
    }
}
export default Auth